package org.dce.screencapturer.components;

import java.awt.GridLayout;
import java.util.List;

import javax.swing.Action;
import javax.swing.JButton;
import javax.swing.JPanel;

import org.dce.screencapturer.components.ui.ActionButtonUI;

@SuppressWarnings("serial")
public class ActionPanel 
	extends JPanel{

	public ActionPanel(){
		setLayout(new GridLayout(2, 5));
	}
	
	public void addAction(Action action){
		doAddAction(action);
		invalidate();
	}

	private void doAddAction(Action action){
		JButton button = new JButton(action);
		button.setUI(new ActionButtonUI());
		add(button);
	}

	public void addActions(List<? extends Action> actions) {
		for (Action action:actions){
			doAddAction(action);
		}
		invalidate();
	}
}
